function getCurrentDialog() {
    return document.getElementById('dialogname').className;
}

function toggleDialogBar(name) {

    if (getCurrentDialog() == name) {
        if (document.getElementById('dialogbar').style.display == 'none') {

            document.getElementById('dialogbar').style.display = '';
            document.getElementById(name+'button').className = 'buttonSelected';
        } else {
            document.getElementById('dialogbar').style.display = 'none';
            document.getElementById(name+'button').className = 'buttonNormal';
        }
    } else {
        document.getElementById('dialogbarcontent').innerHTML = document.getElementById(name+'dialog').innerHTML;
        if (document.getElementById('dialogbar').style.display == 'none') {
            document.getElementById('dialogbar').style.display = '';
            document.getElementById(name+'button').className = 'buttonSelected';
        } else {
            document.getElementById(getCurrentDialog()+'button').className = 'buttonNormal';
            document.getElementById(name+'button').className = 'buttonSelected';
        }
        document.getElementById('dialogname').className = name;
    }
}

function resizeFileList() {
    document.getElementById('filelist').style.height = document.body.clientHeight - 91;
}